<?php

namespace App\Http\Resources\OpenShop\InvestmentPromotion;

use App\Enums\OpenShop\InvestmentPromotion\UserExperienceEnum;
use App\Service\OpenShop\Feishu\ConfigService;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class UserExperienceResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return array
     * @throws Exception
     */
    public function toArray($request): array
    {
        return [
            'orderNo'                  => $this->orderNo,
            'cateringExperience'       => $this->cateringExperience,
            'cateringExperienceText'   => ConfigService::getConfigText("openShop", "cateringExperience", $this->cateringExperience),
            'joinChainExperience'      => $this->joinChainExperience,
            'joinChainExperienceText'  => ConfigService::getConfigText("openShop", "hasExperience", $this->joinChainExperience),
            'employmentExperience'     => $this->employmentExperience,
            'employmentExperienceText' => ConfigService::getConfigText("openShop", "hasExperience", $this->employmentExperience),
            'workLife'                 => $this->workLife,
            'workLifeText'             => ConfigService::getConfigText("openShop", "workLife", $this->workLife)
        ];
    }
}
